local sk__choujue = fk.CreateSkill {

  name = "sk__choujue",

  tags = {  },

}



sk__choujue:addEffect("viewas", {
  name = "sk__choujue",
  anim_type = "offensive",
  prompt = "#sk__choujue",
  card_filter = Util.FalseFunc,
  view_as = function(self, player,cards)
    local card = Fk:cloneCard("slash")
    card.skillName = sk__choujue.name
    return card
  end,
  before_use = function(self, player, use)
    use.extraUse = true
    player.room:changeMaxHp(player, -1)
    if not player.dead then
      player:drawCards(1, sk__choujue.name)
    end
  end,
  after_use = function(self, player, use)
    if use.damageDealt and not player.dead then
      local skills = table.filter(player.player_skills, function(s)
        return s:isPlayerSkill(player) and s.visible
      end)
      for _, skill in ipairs(skills) do
        if (skill:isInstanceOf(ActiveSkill) or skill:isInstanceOf(ViewAsSkill)) and
          Fk:translate(":"..skill.name, "zh_Cn"):startsWith("出牌阶段限一次") and
          player:usedSkillTimes(skill.name, Player.HistoryPhase) > 0 then
          player:setSkillUseHistory(skill.name, 0, Player.HistoryPhase)
        end
      end
    end
  end,
  enabled_at_play = function(self, player)
    return player:usedSkillTimes(sk__choujue.name, Player.HistoryPhase) == 0
  end,
})

sk__choujue:addEffect("targetmod", {
  name = "#sk__choujue_targetmod",
  bypass_times = function(self, player, skill, scope, card)
    return card and type(card) == "table" and table.contains(card.skillNames, "sk__choujue")
  end,
})

return sk__choujue